package com.av.bcacc.jetpack.nav;


import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.av.bcacc.jetpack.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class NavHomeFragment extends Fragment {


    public NavHomeFragment() {
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_nav_home, container, false);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        getView().findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Bundle bundle = new Bundle();
                bundle.putString("name", "KOBE");
                NavController navController = Navigation.findNavController(v);
                navController.navigate(R.id.action_navHomeFragment_to_navDetailFragment, bundle);
            }
        });


    }
}
